package daily.apr0430;

public class MathTest {
    public static void main(String[] args) {
        //三角函数和角度问题
        System.out.println("sin(π/2)：" + Math.sin(Math.PI / 2));
        System.out.println("sin(90°)：" + Math.signum(90));
        System.out.println("弧度转角度：" + Math.toDegrees(Math.PI / 2));
        System.out.println("角度转弧度：" + Math.toRadians(90));
        //科学计算
        System.out.println("4开方:" + Math.sqrt(4));
        System.out.println("-10.312的绝对值：" + Math.abs(-10.312));
        System.out.println("2的8次方：" + Math.pow(2, 8));
        //四舍五入
        System.out.println("3.1四舍五入：" + Math.round(3.1));
        System.out.println("3.1向上取整：" + Math.ceil(3.1));
        System.out.println("3.1向下取整：" + Math.floor(3.1));
        //最大最小值
        System.out.println("1,2中的最大值：" + Math.max(1, 2));
        System.out.println("1,2中的最小值：" + Math.min(1, 2));
        //随机数
        System.out.println("产生double随机数（0～1）：" + Math.random());
        //对数运算
        System.out.println("ln(10)：" + Math.log(10));//底数为e
        System.out.println("lg(10)：" + Math.log10(10));//底数为10
    }
}

